package priv.cwr.springboot.demo.configuration;

/**
 * User: R
 * Date: 2018/8/29
 * Time: 17:10
 * Created with IntelliJ IDEA.
 */
public interface Global {
    /**
     * 系统通用的错误码枚举
     * 可以通过yml覆盖
     */
    enum Errors {
        SUCCESS(0, "success"),
        NOT_FOUND(9404, "${0}未找到"),
        SYSTEM_UNKNOWN(9901, "未知错误"),
        SYSTEM_BUSY(9902, "当前请求过多或服务器繁忙，请稍后再试"),
        VALID_ERROR(9906, "请求参数错误");

        /**
         * 错误代码
         */
        private int code;
        /**
         * 错误信息
         */
        private String message;

        Errors(int code, String message) {
            this.code = code;
            this.message = message;
        }

        public int getCode() {
            return code;
        }

        public String getMessage() {
            return message;
        }

    }
}
